home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / win / tkWin32Dll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  1.9 KB  |  86 lines  |  [TEXT/CWIE]

  1. /* 
  2.  * tkWin32Dll.c --
  3.  *
  4.  *    This file contains a stub dll entry point.
  5.  *
  6.  * Copyright (c) 1995 Sun Microsystems, Inc.
  7.  *
  8.  * See the file "license.terms" for information on usage and redistribution
  9.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  10.  *
  11.  * SCCS: @(#) tkWin32Dll.c 1.9 96/08/06 15:59:08
  12.  */
  13.  
  14. #include "tkPort.h"
  15. #include "tkWinInt.h"
  16.  
  17. /*
  18.  * The following declaration is for the VC++ DLL entry point.
  19.  */
  20.  
  21. BOOL APIENTRY        DllMain _ANSI_ARGS_((HINSTANCE hInst,
  22.                 DWORD reason, LPVOID reserved));
  23.  
  24. /*
  25.  *----------------------------------------------------------------------
  26.  *
  27.  * DllEntryPoint --
  28.  *
  29.  *    This wrapper function is used by Borland to invoke the
  30.  *    initialization code for Tk.  It simply calls the DllMain
  31.  *    routine.
  32.  *
  33.  * Results:
  34.  *    See DllMain.
  35.  *
  36.  * Side effects:
  37.  *    See DllMain.
  38.  *
  39.  *----------------------------------------------------------------------
  40.  */
  41.  
  42. BOOL APIENTRY
  43. DllEntryPoint(hInst, reason, reserved)
  44.     HINSTANCE hInst;        /* Library instance handle. */
  45.     DWORD reason;        /* Reason this function is being called. */
  46.     LPVOID reserved;        /* Not used. */
  47. {
  48.     return DllMain(hInst, reason, reserved);
  49. }
  50.  
  51. /*
  52.  *----------------------------------------------------------------------
  53.  *
  54.  * DllMain --
  55.  *
  56.  *    DLL entry point.
  57.  *
  58.  * Results:
  59.  *    TRUE on sucess, FALSE on failure.
  60.  *
  61.  * Side effects:
  62.  *    None.
  63.  *
  64.  *----------------------------------------------------------------------
  65.  */
  66.  
  67. BOOL APIENTRY
  68. DllMain(hInstance, reason, reserved)
  69.     HINSTANCE hInstance;
  70.     DWORD reason;
  71.     LPVOID reserved;
  72. {
  73.     /*
  74.      * If we are attaching to the DLL from a new process, tell Tk about
  75.      * the hInstance to use. If we are detaching then clean up any
  76.      * data structures related to this DLL.
  77.      */
  78.     
  79.     if (reason == DLL_PROCESS_ATTACH) {
  80.         TkWinXInit(hInstance);
  81.     } else if (reason == DLL_PROCESS_DETACH) {
  82.         TkWinXCleanup(hInstance);
  83.     }
  84.     return(TRUE);
  85. }
  86.